package com.woniuxy.springcloud.consumer.student.feignclient;

import com.github.pagehelper.PageInfo;
import com.woniuxy.springcloud.common.entity.PageDto;
import com.woniuxy.springcloud.common.entity.ResponseResult;
import com.woniuxy.springcloud.common.entity.Student;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * description: StudentFeignClient <br>
 * date: 2022/1/21 10:18 下午 <br>
 * author: shesaifei <br>
 * version: 1.0 <br>
 */
//定义接口，声明Feign调用，指定要调用的服务名
//接口中定义的方法，就是要调用的8081中的方法和请求路径

@FeignClient(value = "provider-student", fallback = StudentFeignClientFallback.class)
//@RequestMapping("/student")
public interface StudentFeignClient {

    @PostMapping("/student/")
    public ResponseResult addStudent(@RequestBody Student student);

    @GetMapping("/student/{sid}")
    public ResponseResult<Student> getStudent(@PathVariable("sid") Integer sid);

    @GetMapping("/student/")
    public ResponseResult<List<Student>> getAllStudent();

    @RequestMapping("/student/findAllStudent")
    public ResponseResult<PageInfo<Student>> findAllStudent(@RequestBody PageDto pageDto);

    @GetMapping("/student/timeout")
    public ResponseResult<String> timeout();

    @GetMapping("/student/ok")
    public ResponseResult<String> ok();
}
